This script compairs all installed languagepacks. <font color="red">Caution! Make shure that all installed languagepacks are ok before you confirm an update.</font>
<?
//search for installed languages
$dh = opendir("lang");
while (($file = readdir($dh)) !== false){
    if(is_dir("lang/$file") AND $file!=".." AND $file!="." AND substr($file,0,1)!="."){
	    $languages[]=$file;
    }
}
closedir($dh);
//load all the languages
ob_start();
foreach($languages as $language){
	//running through all language files
	$dh=opendir("lang/$language/");
	while(($file = readdir($dh)) !== false){
	    if(substr($file,-9)==".lang.php"){
            unset($lang);
			include("lang/$language/$file");
			$sprache[$file][$language]=$lang;
		}
	}
	closedir($dh);
}
ob_end_clean();
echo "
<table width=\"100%\" border=\"1\">
  <tr>
    <th>Item \ Language</th>";
    foreach($languages AS $language){
	    echo "<th>$language</th>";
	}
	echo "
	<th>Option</th>
  </tr>
  ";
  foreach($sprache AS $filename=>$file){
      $status=0;
      //Referenz suchen
	  $ref="";
	  $anzahl=0;
	  foreach($languages as $language){
	      $entr=count($file[$language]);
		  if($entr==0 OR $entr>$anzahl){
		      $ref=$language;
			  $anzahl=$entr;
		  }
	  }
      echo "
	  <tr>
	    <th>$filename</th>";		
        foreach($languages AS $language){
	        echo "
			<td>";
			if($ref==$language){
			    echo "<font style=\"font-weight:bold;\">";
			}elseif(count($file[$language])!=$anzahl){
			    echo "<font style=\"color:red\">";
				$status=1;
			}else{
			    echo "<font color=\"\">";
			}
			echo count($file[$language])."			
		    </td>";
	    }
		echo "			
		<td>";
		  if($status!=0){
		      echo "<input type=\"button\" value=\"solve\" onclick=\"location.href='index.php?page=admin&adminpage=language&solve=$filename';\"/>";
		  }else{
			  echo "ok";
		  }
		  echo "
		</td>
      </tr>";
  }
  echo "
</table>";

if(isset($sprache[$_GET[solve]])){
	echo "Allitems:";
    $file=$sprache[$_GET[solve]];
    settype($allItems, "Array");
    foreach($file AS $langpack){
    	$allItems=array_merge($allItems, $langpack)	;
    }
    ksort($allItems);
    print_r($allItems);
}